package com.sjzxywlkj.cplife.alipay.conn;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayEcoCplifeBasicserviceInitializeRequest;
import com.alipay.api.request.AlipayEcoCplifeBasicserviceModifyRequest;
import com.alipay.api.response.AlipayEcoCplifeBasicserviceInitializeResponse;
import com.alipay.api.response.AlipayEcoCplifeBasicserviceModifyResponse;
import com.sjzxywlkj.cplife.alipay.config.AlipayConfig;
import com.sjzxywlkj.cplife.alipay.request.entity.BasicserviceInitialize;
import com.sjzxywlkj.cplife.alipay.request.entity.BasicserviceModify;


/**
 * 初始化小区服务操作
 */
public class BasicserviceConn {

    //初始化小区物业基础服务
    public static AlipayEcoCplifeBasicserviceInitializeResponse initialize(BasicserviceInitialize basicserviceInitialize, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBasicserviceInitializeRequest request = new AlipayEcoCplifeBasicserviceInitializeRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(basicserviceInitialize.toJson());
        AlipayEcoCplifeBasicserviceInitializeResponse response = alipayClient.execute(request);
        return response;
    }

    // 修改小区物业基础服务信息
    public static AlipayEcoCplifeBasicserviceModifyResponse modify(BasicserviceModify basicserviceModify, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeBasicserviceModifyRequest request = new AlipayEcoCplifeBasicserviceModifyRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(basicserviceModify.toJson());
        AlipayEcoCplifeBasicserviceModifyResponse response = alipayClient.execute(request);
        return response;
    }
}
